//
//  FeedbackVC.swift
//  com.yunshu.yunshuapp
//
//  Created by 周文杰 on 2017/6/18.
//  Copyright © 2017年 zwj. All rights reserved.
//

import UIKit

class FeedbackVC: UIViewController {

    
    @IBOutlet weak var textView: UITextView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        self.title = "意见反馈"
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    @IBAction func onSubmit(_ sender: Any) {
        
        guard let txt = self.textView.text else{
            self.navigationController?.view.makeToast("请输入反馈内容")
            return;
        }
        let params = ["content":txt,"type":"0","asker":User.get.phone]
        _ = NetworkManager.POST(NetworkManager.Feedback , params: params) {
            (isSucce, resp) in
            if isSucce {
                let alert = UIAlertController(title: "提示", message:"反馈内容发送成功，感谢您的宝贵意见", preferredStyle: UIAlertController.Style.alert)
                
                let action = UIAlertAction.init(title: "确定", style: .cancel, handler: { (action1) in
                    self.navigationController?.popViewController(animated: true)
                })
                
                alert.addAction(action)
                self.navigationController?.present(alert, animated: true, completion: nil)
            }
        }
        
        
    }

}
